package router

import (
	"api-gateway/basic/config"
	"api-gateway/handler/api"
	"api-gateway/midderware"
	"github.com/gin-gonic/gin"
)

func UserRouter(v1 *gin.RouterGroup) {
	user := v1.Group("/user")
	{
		user.POST("/createUser", api.CreateUser) //注册
		user.POST("/login", api.Login)           //登录

		//短信验证码
		user.POST("/sendSms", api.SendSms)
		user.Use(midderware.JWTAuth(config.KEY_JWT))             //中间件
		user.POST("/del", api.Del)                               //用户注销
		user.POST("/userUpdatePassword", api.UserUpdatePassword) //用户修改密码
		user.POST("/userProfileCreated", api.UserProfileCreated) //用户添加个人资料
		user.POST("/userProfileUpdated", api.UserProfileUpdated) //用户修改个人资料
		user.GET("/userProfileDetail", api.UserProfileDetail)    //用户个人资料详情
		user.POST("/userOpinionAdd", api.UserOpinionAdd)         //用户反馈添加
		user.POST("/equipmentBinding", api.EquipmentBinding)     //用户设备绑定
		user.POST("/registerFace", api.RegisterFace)             //人脸注册
		user.POST("/loginFace", api.LoginFace)                   //人脸登录
		user.POST("/addCollect", api.AddCollect)                 //收藏添加
		user.GET("/listCollect", api.ListCollect)                //收藏展示
		user.POST("/deletedCollect", api.DeleteCollect)          //收藏删除
	}
	points := v1.Group("/points")
	{
		points.Use(midderware.JWTAuth(config.KEY_JWT))
		points.POST("/CheckIn", api.UserCheckIn)          //签到
		points.GET("/GetCheckInList", api.GetCheckInList) //获取签到列表
		points.POST("/MakeUpCheckIn", api.MakeUpCheckIn)  //获取积分
		points.GET("/GetCheckInInfo", api.GetCheckInInfo) //获取签到信息
	}
	trustedDevice := v1.Group("/trustedDevice")
	{
		trustedDevice.Use(midderware.JWTAuth(config.KEY_JWT))
		trustedDevice.POST("/trustedDeviceAdd", api.TrustedDeviceAdd)       //信任设备添加
		trustedDevice.POST("/trustedDeviceDel", api.TrustedDeviceDel)       //信任设备删除
		trustedDevice.POST("/trustedDeviceUpdate", api.TrustedDeviceUpdate) //信任设备修改
		trustedDevice.GET("/trustedDeviceFind", api.TrustedDeviceFind)      //信任设备展示
	}
	member := v1.Group("/member")
	{
		member.POST("/memberBenefitAdd", api.MemberBenefitAdd) //会员权益添加
		member.POST("/memberLevelAdd", api.MemberLevelAdd)     //会员等级添加
		member.POST("/memberLevelDel", api.MemberLevelDel)     //会员等级删除
		member.Use(midderware.JWTAuth(config.KEY_JWT))
		member.GET("/memberBenefitFind", api.MemberBenefitFind)     //会员权益展示
		member.GET("/memberBenefitDetail", api.MemberBenefitDetail) //会员权益详情
		member.GET("/memberLevelFind", api.MemberLevelFind)         //会员等级展示
		member.GET("/memberLevelDetail", api.MemberLevelDetail)     //会员等级详情
		member.POST("/memberAdd", api.MemberAdd)                    //会员添加
		member.GET("/memberDetail", api.MemberDetail)               //会员详情
		member.POST("/memberServiceAdd", api.MemberServiceAdd)      //用户会员续费
	}
	medal := v1.Group("/medal")
	{
		medal.POST("/badgeRulesAdd", api.BadgeRulesAdd) //勋章规则添加
		medal.POST("/userBadgesAdd", api.UserBadgesAdd) //用户勋章添加
		medal.Use(midderware.JWTAuth(config.KEY_JWT))
		user.GET("/badgeRulesDetail", api.BadgeRulesDetail) //勋章规则详情
		user.GET("/userBadgesFind", api.UserBadgesFind)     //用户勋章展示
	}
}
